﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="FA_BuyPlan.aspx.cs" Inherits="FixedAssets.Module.ManagementProcess.FA_BuyPlan" %>

<%@ Register Assembly="C1.Web.Wijmo.Controls.4, Version=4.0.20132.126, Culture=neutral, PublicKeyToken=9b75583953471eea"
    Namespace="C1.Web.Wijmo.Controls.C1Menu" TagPrefix="wijmo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <link href="../../Styles/jquery.wijmo.wijsuperpanel.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/jquery.wijmo.wijgrid.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/jquery.wijmo.wijpager.css" rel="stylesheet" type="text/css" />
   
   <script src="../../Scripts/jquery-2.0.3.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
    <script src="../../Scripts/globalize.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.wijmo.widget.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.wijmo.wijutil.js" type="text/javascript"></script>
    <script src="../../Scripts/wijmo.data.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.wijmo.wijsuperpanel.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.wijmo.wijpager.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.wijmo.wijgrid.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var v_gcol = getgridcolumns();
            // bind the grid
            $("#grid").wijgrid({
                scrollMode: "auto",
                allowPaging: true,
                allowEditing: true,
                pageSize: 10,
                pagerSettings: { position: "bottom", mode: "nextPreviousFirstLast" },
                columnsAutogenerationMode: "none",
                columns: v_gcol,
                allowKeyboardNavigation: true,
                highlightCurrentCell: true,
                selectionMode: "none",
                beforeCellEdit: onBeforeCellEdit,
                afterCellEdit: onAfterCellEdit,
                beforeCellUpdate: onBeforeCellUpdate
            });
            //$("#grid").wijgrid("option", "data", Data());
        });

        // random data generators
        function Data() {
            var data = [];
            var v_col = eval($("input[type=hidden][name*=col_hid]").val());
            data.push({
                ID: 1,
                FA0001: "",
                FA0002: "",
                FA0003: "",
                FA0004: "",
                FA0005: "",
                FA0006: "",
                FA0007: "",
                FA0008: ""
            });
            return data;
        }
        function getString(arr) {
            return arr[Math.floor((Math.random() * arr.length))];
        }
        function getNumber(lo, hi) {
            return lo + Math.random() * (hi - lo);
        }
        function getDate(daysAgo) {
            return new Date((new Date()).getTime() - daysAgo * 24 * 3600 * 1000);
        }
        function getgridcolumns() {
            var v_columns = eval($("input[type=hidden][name*=grid_hid]").val());
            return v_columns;
        }
        // create custom editors for Country, Quantity, and UnitPrice columns
        function onBeforeCellEdit(e, args) {
            switch (args.cell.column().dataKey) {
                case "Country":
                    createCombo(args, getCountries());
                    args.handled = true;
                    break;
                case "ProductName":
                    createCombo(args, getProducts());
                    args.handled = true;
                    break;

                case "Quantity":
                    createNumberInput(args, 0);
                    args.handled = true;
                    break;

                case "UnitPrice":
                    createNumberInput(args, 2);
                    args.handled = true;
                    break;

                case "Discount":
                    createNumberInput(args, 2);
                    args.handled = true;
                    break;
            }
        }
        // delete custom editors when done
        function onAfterCellEdit(e, args) {
            switch (args.cell.column().dataKey) {
                case "Country":
                case "Product":
                    args.cell.container().find("input").wijcombobox("destroy");
                    break;
                case "Quantity":
                case "UnitPrice":
                case "Discount":
                    args.cell.container().find("input").wijinputnumber("destroy");
                    break;
            }
        }

        // prevent users from entring invalid data
        function onBeforeCellUpdate(e, args) {
            switch (args.cell.column().dataKey) {
                case "Discount":
                    var editor = args.cell.container().find("input");
                    var value = editor.wijinputnumber("getValue");
                    if (value > .3) {
                        //editor.addClass("ui-state-error")
                        alert("Sorry, discounts cannot be greater than 30%.");
                        editor.focus();
                        return false;
                    }
                    args.value = value;
                    break;
            }
        }
    </script>
    <div>
        <span>购置计划</span>
    </div>
    <div>
        <wijmo:C1Menu ID="C1Menu1" runat="server" BackLinkText="后退" CrumbDefaultText="选择一个选项"
            TopLinkText="全部">
            <Animation Option="">
            </Animation>
            <ShowAnimation Option="">
            </ShowAnimation>
            <HideAnimation Option="">
                <Animated Effect="fade"></Animated>
            </HideAnimation>
            <Items>
                <wijmo:C1MenuItem runat="server" Text="查询" Value="Create">
                </wijmo:C1MenuItem>
                <wijmo:C1MenuItem runat="server" Text="新增" Value="Add">
                </wijmo:C1MenuItem>
                <wijmo:C1MenuItem runat="server" Text="编辑" Value="Edit">
                </wijmo:C1MenuItem>
                <wijmo:C1MenuItem runat="server" Text="删除" Value="Delete">
                </wijmo:C1MenuItem>
            </Items>
        </wijmo:C1Menu>
    </div>
    <div runat="server" id="Create_div">
        <table width="100%" border="1">
            <tr>
                <td>
                    新增购置计划
                </td>
            </tr>
            <tr>
                <td>
                    <table border="1" width="100%">
                        <tr>
                            <td>
                                购置计划名称：<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                编制计划部门：<asp:DropDownList ID="DropDownList1" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td>
                                编制计划日期:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                提交上级部门：<asp:DropDownList ID="DropDownList2" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td>
                                是否提交：<asp:CheckBox ID="CheckBox1" runat="server" />
                            </td>
                        </tr>
                    </table>
                    <%--<asp:Panel runat="server" ID="P_Create"></asp:Panel>--%>
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <table id="grid" style="height: 300px">
                        </table>
                        <div>
                        </div>
                    </div>
                    <input type="hidden" runat="server" id="grid_hid" name="grid_hid" />
                    <input type="hidden" runat="server" id="col_hid" name="col_hid" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnSave" runat="server" Text="保存" OnClick="btnSave_Click" />
                    <asp:Button ID="btnCancle" runat="server" Text="取消" OnClick="btnCancle_Click" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
